package org.skyeye.modeling.commands;

import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.commands.Command;
import org.skyeye.modeling.model.MDevice;



public class ChangeNodeConstraintCommand extends Command {

	private MDevice node;

	private Point oldPos;

	private Point newPos;

	private Dimension oldSize;

	private Dimension newSize;

	public void setLocation(Point p) {
		oldPos = this.node.getLocation();
		this.newPos = p;
	}

	public void setDimension(Dimension d) {
		oldSize = this.node.getSize();
		this.newSize = d;
	}

	public void setNode(MDevice node) {
		this.node = node;
	}

	public void execute() {
		node.setLocation(newPos);
		
	}

	public String getLabel() {
		return "";
	}

	public void redo() {
		execute();
	}

	public void undo() {
		this.node.setLocation(oldPos);
	}
}